package ink.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import ink.xiaobaibai.valited.UpdateGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author xiaobaibai
 * @since 2021-05-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("monthlyfee_device")
@NoArgsConstructor
public class MonthlyfeeDevice implements Serializable {

    private static final long serialVersionUID = 1L;

    public MonthlyfeeDevice(String deviceCode, Integer adminUserId, Integer depId, String status) {
        this.deviceCode = deviceCode;
        this.adminUserId = adminUserId;
        this.depId = depId;
        this.status = status;
    }

    /**
     * 包月机器自增主键表
     */
    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(groups = UpdateGroup.class)
    private Integer id;

    /**
     * 包月机器识别码
     */
    @TableField("device_code")
    @NotNull
    @NotNull(groups = UpdateGroup.class)
    private String deviceCode;

    /**
     * 对应管理者id
     */
    @TableField("admin_user_id")
//    @Null
//    @Null(groups = UpdateGroup.class)
    private Integer adminUserId;

    /**
     * 对应机器部门id
     */
    @TableField("dep_id")
    @Null
    @Null(groups = UpdateGroup.class)
    private Integer depId;

    /**
     * 对应氧气机id
     */
    @TableField("oxygen_id")
    @NotNull(message = "对应氧气机id不可为空")
    @NotNull(groups = UpdateGroup.class)
    private Integer oxygenId;

    /**
     * 设备状态:空闲中,借出中
     */
    @TableField("status")
    @Null(message = "不可填写状态")
    @Null(groups = UpdateGroup.class)
    private String status;

    /**
     * 启动延时
     */
    @TableField("delayed_time")
    @NotNull
    @Min(0)
    @NotNull(groups = UpdateGroup.class)
    @Min(value = 0, groups = UpdateGroup.class)
    private Integer delayedTime;

    /**
     * 风扇延时
     */
    @TableField("fan_time")
    @NotNull
    @Min(0)
    @NotNull(groups = UpdateGroup.class)
    @Min(value = 0, groups = UpdateGroup.class)
    private Integer fanTime;

    /**
     * 阀门延时
     */
    @TableField("valve_time")
    @NotNull
    @Min(0)
    @NotNull(groups = UpdateGroup.class)
    @Min(value = 0, groups = UpdateGroup.class)
    private Integer valveTime;

    /**
     * 机器型号
     */
    @TableField("type")
    private String type;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 是否被托管
     */
    @TableField(exist = false)
    private Boolean trusteeship;

    /**
     * 是否被借出去了
     */
    @TableField(exist = false)
    private Boolean lending;


}
